package cn.player.utils;

import android.app.Activity;
import android.view.Window;
import android.view.WindowManager.LayoutParams;

public class CommUtil {
	
	/**
	 * 显示系统锁屏界面
	 * @param activity
	 */
	public static void ennableKeyGuard(Activity activity) {
		Window window = activity.getWindow();
		LayoutParams attributes = window.getAttributes();
		attributes.flags = LayoutParams.FLAG_SHOW_WHEN_LOCKED;
		window.setAttributes(attributes);
	}
	
	/**
	 * 打开系统锁屏界面
	 * @param activity
	 */
	public static void disableKeyGuard(Activity activity) { 
		Window window = activity.getWindow();
		LayoutParams attributes = window.getAttributes();
		attributes.flags = LayoutParams.FLAG_DISMISS_KEYGUARD;
		window.setAttributes(attributes);
	}

}
